home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_halltrap.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  243 lines

  1. # Jones 3D Cog Script
  2. #
  3. # shs_Halltrap.cog     Make the planks break and pendulums swing.  
  4. #
  5. # [JWC, SXC]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. message startup
  14. message arrived
  15. message entered
  16. message touched
  17. message    crossed
  18.  
  19. keyframe    smashed=in_die_fall.key         local
  20.  
  21. sound    sndDie=tem_temspikes_up_kill_c.wav    local
  22. sound    sndLog=shs_log_pendulum.wav            local
  23. sound    in_wronghere=Inxj042.wav            local # Something wrong-->in_sayline[4]
  24. sound    mus_Cue=mus_gen_danger3.wav    
  25.  
  26. surface trigger0
  27. surface trigger1
  28. surface trigger2        linkid=1
  29. surface trigger3        linkid=1
  30. surface    linetrigger
  31.  
  32. # near elevator
  33. surface    soundOn            linkid=2
  34. surface    soundOff        linkid=3
  35.  
  36. # near statue
  37. surface    soundOn1        linkid=2
  38. surface    soundOff1        linkid=3
  39.  
  40. thing   log                  mask=0x405
  41. thing    player                local
  42. thing     cam1
  43. thing    cam2
  44.  
  45. thing    logGhost1
  46. thing    logGhost2
  47. thing    logGhost3
  48.  
  49. int        curCam                local   
  50. int        enterflag=0            local
  51. int        hearSound=0            local
  52. int     spoken=0            local
  53.  
  54. int        logPitch0=10        local
  55. int        logPitch1=25        local
  56. int        logPitch2=110        local
  57. int        logPitch3=25        local
  58. int        logPitch4=10        local
  59.  
  60. flex    logTime0=0.2        local        // Time it takes to get between positions 0 and 1, and vice versa.
  61. flex    logTime1=0.2        local        // Time it takes to get between positions 1 and 2, and vice versa.
  62. flex    logTime2=0.45        local        // Time it takes to get between positions 2 and 3, and vice versa.
  63. flex    logTime3=0.2        local        // Time it takes to get between positions 3 and 4, and vice versa.
  64. flex    logTime4=0.2        local        // Time it takes to get between positions 4 and 5, and vice versa.
  65.  
  66. int        logDirection=1        local
  67. int        nextLogTime=0        local
  68. int        nextLogPosition=0    local
  69.  
  70. vector    logPYR                local
  71.  
  72. #SUB-ROUTINES
  73.  
  74. flex    rotatelog            local
  75.  
  76. end
  77.  
  78. # ========================================================================================
  79.  
  80. code
  81.  
  82. startup:
  83.     
  84.     player = GetLocalPlayerThing();
  85.     curCam = GetCurrentCamera();
  86.     SetThingLight(log, '0.30 0.30 0.25', 0.01, 0.01);
  87.     AttachThingToThingEx(logGhost3, log, 0x08);
  88.     return;      
  89.  
  90. entered:
  91.  
  92.     if (GetSenderRef() == trigger0)     
  93.     {
  94.                 
  95.         # Prep camera & cut...
  96.         SetCameraLookInterp(2, 0);            # kill pan & tilt to lock on 2nd target
  97.         SetCameraPosInterp(2, 0);            # kill dolly mode too
  98.         SetCameraFocus(2, cam1);
  99.         SetCameraSecondaryFocus(2, player);
  100.         Sleep(0.01);
  101.         SetCurrentCamera(2);
  102.         ResetCameraFOV(0, 0.0);
  103.         print("entered");
  104.         
  105.         if (enterflag == 0)
  106.         {    
  107.             enterflag=1;
  108.             call rotatelog;
  109.         }
  110.     }
  111.     
  112.     # Switch cameras
  113.     if (GetSenderRef() == trigger1)
  114.     {
  115.         Print("cam should switch");
  116.         # Prep camera & cut...
  117.         SetCameraLookInterp(2, 0);            # kill pan & tilt to lock on 2nd target
  118.         SetCameraPosInterp(2, 0);            # kill dolly mode too
  119.         SetCameraFocus(2, cam2);
  120.         SetCameraSecondaryFocus(2, player);
  121.         Sleep(0.01);
  122.         SetCurrentCamera(2);
  123.         ResetCameraFOV(0, 0.0);
  124.     }
  125.     
  126.     # Warning music and line
  127.     if ((GetSenderRef() == linetrigger) && (spoken == 0))
  128.     {
  129.         spoken=1;
  130.         PlaySoundLocal(mus_Cue, 1.0, 0.0, 0x0, 0);
  131.         sleep(1);
  132.         PlayVoice(player, in_wronghere, 1, 0);
  133.     }
  134.  
  135.     return;
  136.  
  137. crossed:
  138.  
  139.     # Return to normal camera
  140.     if (GetSenderId() == 1)
  141.     {
  142.         Print("exited");
  143.         SetCameraPosition(1, GetThingPos(cam1));    # prep for camera to swing back
  144.         SetCameraLookInterp(2, 0); # kill pan & tilt mode
  145.         SetCameraPosInterp(2, 0); # kill dolly mode
  146.         Sleep(0.01);
  147.         SetCurrentCamera(1);
  148.     }
  149.     
  150.     # Sound in range
  151.     if (GetSenderId() == 2)
  152.     {
  153.         hearSound=1;
  154.         ClearThingFlags(log, 0x10);
  155.     }
  156.     # Sound out of range
  157.     if (GetSenderId() == 3)
  158.     {
  159.         hearSound=0;
  160.         SetThingFlags(log, 0x10);
  161.     }
  162.     
  163.     return;
  164.  
  165.  
  166.  
  167.  
  168. arrived:
  169.     if (GetSenderRef() == log)     
  170.     {
  171. //        DebugLocalSymbols();
  172. //        DebugWaitForKey();
  173.         call rotatelog;
  174.     }
  175.  
  176.     return;
  177.  
  178. touched:
  179.  
  180.     if ((GetSenderRef() == log) && (GetSourceRef() == player))
  181.     {
  182.         DamageThing(player, 1000, 0x1, log);
  183.         SetCollideType(log, 0);
  184.         PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  185.         PlayKey(player, smashed, 10, 0x14, 0);
  186.     }
  187.     return;
  188.  
  189. rotatelog:
  190.     
  191.     
  192.     if (((nextLogPosition == 4) && (logDirection == -1)) ||
  193.         ((nextLogPosition == 0) && (logDirection == 1)))
  194.     {
  195.         // We're at the top of outr swing, so snap us to a good position and then
  196.         // hesitate a bit before reversing direction.
  197.  
  198.         if (nextLogPosition == 0)
  199.             CopyOrient(logGhost1, log);
  200.         else
  201.             CopyOrient(logGhost2, log);
  202.  
  203.         Sleep(0.05);
  204.         
  205.         if (hearSound) 
  206.         {
  207.             # log sound
  208.             PlaySoundThing(sndLog, logGhost3, 1.0, 5, 12, 0);
  209.         }
  210.     }
  211.  
  212.     if (logDirection == 1)
  213.         Rotate(log, logPitch0[nextLogPosition], 0, logTime0[nextLogTime]);
  214.     else
  215.         Rotate(log, -logPitch0[nextLogPosition], 0, logTime0[nextLogTime]);
  216.     
  217.     
  218.     nextLogPosition = nextLogPosition + logDirection;
  219.     nextLogTime = nextLogTime + logDirection;
  220.  
  221.     if (nextLogPosition > 4)
  222.     {
  223.         logDirection = -1;
  224.         nextLogPosition = 4;
  225.         nextLogTime = 4;
  226.     }
  227.     else
  228.     {
  229.         if (nextLogPosition < 0)
  230.         {
  231.             logDirection = 1;
  232.             nextLogPosition = 0;
  233.             nextLogTime = 0;
  234.         }
  235.     }
  236.  
  237.     return;
  238.  
  239. end
  240.  
  241.  
  242.  
  243.